package com.dyp.demo.ctr;

import com.dyp.demo.model.People;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/mvc")
public class ResponseEntityCtr {
    @GetMapping(value = "people/info/{id}/by/re")
    public ResponseEntity<People> sayHi5(@PathVariable(name="id") int id,
                                         @RequestParam int num,
                                         @RequestBody People people)
    {
        people.setId(id);
        people.setNum(num);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Custom-Header", "foo");
        return new ResponseEntity(people,headers, HttpStatus.OK);
    }
}
